<%-- ExMobi JSP文件，注释和取消快捷键统一为Ctrl+/ 多行注释为Ctrl+Shift+/ --%>
<%@ page language="java" import="java.util.*"
 contentType="application/json; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/client/adapt.jsp"%>
<%@ include file="/client/adapt_extend.jsp"%>
<%@ include file="properties.jsp"%>
<%
   String wd = aa.req.getParameter("keyword");
   String url = "http://fy.webxml.com.cn/webservices/EnglishChinese.asmx";

%>
<aa:http id="trans" url="<%=url %>" keepreqdata="false" method="post" >
  <aa:header name="Content-Type" value="application/soap+xml;charset=UTF-8;action=http://WebXml.com.cn/Translator"/>
  <aa:content>
     <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://WebXml.com.cn/">
	   <soap:Header/>
	   <soap:Body>
	      <web:Translator>	        	         
	      	<web:wordKey><%=wd %></web:wordKey>
	      </web:Translator>
	   </soap:Body>
	</soap:Envelope> 	  
  </aa:content>
</aa:http>
<%
  String xmlstr = aa.regex.regex(".*","trans");
%>
<aa:datasource id="transxml" value="<%=xmlstr %>" wellformed="true"></aa:datasource>
<%
  JSONObject transobj = new JSONObject();
  JSONArray  transarr = new JSONArray();
  
  
    transobj.put("WordKey", aa.xpath.xpath("//WordKey","transxml"));
	transobj.put("Pron",  aa.xpath.xpath("//Pron","transxml"));
	transobj.put("Translation",  aa.xpath.xpath("//Translation","transxml"));
%>
   <aa:for-each var="item" xpath="//Sentence" dsId="transxml">
       <%
      
          JSONObject obj = new JSONObject();
		   obj.put("Orig", aa.xpath.xpath("./Orig/.", "item"));
		   obj.put("Trans", aa.xpath.xpath("./Trans/.", "item"));
		   transarr.put(obj);
       
       
       %>  
   </aa:for-each>

<%	
	transobj.put("list", transarr);
    String recall = aa.req.getParameter("callback");
	out.print(jsonp(recall,transobj.toString()));
		
  
%>
